package com.louis.buddhist.dao;

import java.util.Map;

import org.greenrobot.greendao.AbstractDao;
import org.greenrobot.greendao.AbstractDaoSession;
import org.greenrobot.greendao.database.Database;
import org.greenrobot.greendao.identityscope.IdentityScopeType;
import org.greenrobot.greendao.internal.DaoConfig;

import com.louis.buddhist.data.entity.Read;
import com.louis.buddhist.data.entity.Book;
import com.louis.buddhist.data.entity.CollectEntity;

import com.louis.buddhist.dao.ReadDao;
import com.louis.buddhist.dao.BookDao;
import com.louis.buddhist.dao.CollectEntityDao;

// THIS CODE IS GENERATED BY greenDAO, DO NOT EDIT.

/**
 * {@inheritDoc}
 * 
 * @see org.greenrobot.greendao.AbstractDaoSession
 */
public class DaoSession extends AbstractDaoSession {

    private final DaoConfig readDaoConfig;
    private final DaoConfig bookDaoConfig;
    private final DaoConfig collectEntityDaoConfig;

    private final ReadDao readDao;
    private final BookDao bookDao;
    private final CollectEntityDao collectEntityDao;

    public DaoSession(Database db, IdentityScopeType type, Map<Class<? extends AbstractDao<?, ?>>, DaoConfig>
            daoConfigMap) {
        super(db);

        readDaoConfig = daoConfigMap.get(ReadDao.class).clone();
        readDaoConfig.initIdentityScope(type);

        bookDaoConfig = daoConfigMap.get(BookDao.class).clone();
        bookDaoConfig.initIdentityScope(type);

        collectEntityDaoConfig = daoConfigMap.get(CollectEntityDao.class).clone();
        collectEntityDaoConfig.initIdentityScope(type);

        readDao = new ReadDao(readDaoConfig, this);
        bookDao = new BookDao(bookDaoConfig, this);
        collectEntityDao = new CollectEntityDao(collectEntityDaoConfig, this);

        registerDao(Read.class, readDao);
        registerDao(Book.class, bookDao);
        registerDao(CollectEntity.class, collectEntityDao);
    }
    
    public void clear() {
        readDaoConfig.clearIdentityScope();
        bookDaoConfig.clearIdentityScope();
        collectEntityDaoConfig.clearIdentityScope();
    }

    public ReadDao getReadDao() {
        return readDao;
    }

    public BookDao getBookDao() {
        return bookDao;
    }

    public CollectEntityDao getCollectEntityDao() {
        return collectEntityDao;
    }

}
